home *** CD-ROM | disk | FTP | other *** search
/ Champak 86 / (Vol 86) My Disc.iso / Games / moda_1223.swf / scripts / DefineSprite_123 / frame_1 / DoAction.as
Text File  |  2009-04-23  |  2KB  |  57 lines

  1. var flowerName = "sunflower";
  2. var flowerSize = 4;
  3. var flowerDuration = 12;
  4. var animationType = "over";
  5. var leafDuration = flowerDuration / 2;
  6. var msListener = new Object();
  7. var count = 0;
  8. var nameCount = 0;
  9. var drawing = false;
  10. var deleteCount = 0;
  11. msListener.onMouseDown = function()
  12. {
  13.    drawing = true;
  14. };
  15. msListener.onMouseMove = function()
  16. {
  17.    nameCount += 1;
  18.    count++;
  19.    if(animationType == "over")
  20.    {
  21.       drawing = true;
  22.    }
  23.    if(drawing and count > leafDuration)
  24.    {
  25.       _parent.flowerBox.attachMovie("leaf1","leaf" + nameCount,getNextHighestDepth(),{_x:_xmouse,_y:_ymouse,_width:18,_height:39});
  26.       _parent.flowerBox["leaf" + nameCount]._rotation = random(360);
  27.    }
  28.    if(drawing and count > flowerDuration)
  29.    {
  30.       _parent.flowerBox.attachMovie(flowerName,"flower" + nameCount,getNextHighestDepth(),{_x:_xmouse,_y:_ymouse,_width:flowerSize,_height:flowerSize});
  31.       _parent.flowerBox["flower" + nameCount]._rotation = random(360);
  32.    }
  33.    if(count > flowerDuration)
  34.    {
  35.       count = 0;
  36.    }
  37. };
  38. msListener.onMouseUp = function()
  39. {
  40.    drawing = false;
  41. };
  42. var deleteControl = this.createEmptyMovieClip("deleteControl",this.getNextHighestDepth());
  43. deleteControl.onEnterFrame = function()
  44. {
  45.    if(deleteCount < nameCount)
  46.    {
  47.       deleteCount++;
  48.    }
  49.    else
  50.    {
  51.       deleteCount = nameCount;
  52.    }
  53.    _parent.flowerBox["leaf" + deleteCount].gotoAndPlay("out");
  54.    _parent.flowerBox["flower" + deleteCount].gotoAndPlay("out");
  55. };
  56. Mouse.addListener(msListener);
  57.